import pytest
from selenium import webdriver
from selenium.webdriver.common.by import By


@pytest.fixture(scope="function", autouse=False)
def login():
    driver = webdriver.Chrome()
    driver.get("http://localhost:3000/users/login")
    driver.find_element(By.XPATH, "//input[@id='basic_email']").send_keys("15926082622@163.com")
    driver.find_element(By.XPATH, "//input[@id='basic_password']").send_keys("lkm123123!")
    driver.find_element(By.XPATH,
                        "//button[@class='ant-btn css-dev-only-do-not-override-pr0fja ant-btn-primary']").click()

    yield driver
    print("关闭浏览器")
